package com.hmall.web;

import com.hmall.common.dto.PageDTO;
import com.hmall.pojo.ItemDoc;
import com.hmall.pojo.RequestParams;
import com.hmall.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private SearchService searchService;

    @GetMapping("/hi")
    public String hi(){
        return "hi";
    }

    @PostMapping("/list")
    public PageDTO<ItemDoc> list(@RequestBody RequestParams params) throws IOException {
        return searchService.search(params);
    }
}
